<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<title></title>
		<link rel="stylesheet" type="text/css" href="css/reset.css"/>
		<link rel="stylesheet" type="text/css" href="css/iconfont.css"/>
		<link rel="stylesheet" type="text/css" href="css/denglu.css"/>
	</head>
	<body>
		<div id="box">
			<header class="header-top">
			 <h2>开心摇摇用户登录</h2>
			</header>
			<section class="content">
				<div class="account">
					<input type="text" name="" id="username" placeholder="请输入账号" />
				</div>
				<div class="account">
					<input type="password" name="" id="password" placeholder="请输入密码" />
				</div>
				<div class="reveal">
					  <input type="checkbox" name="" id="rado" value="" /> &nbsp; 显示密码 
				
					<a href="#">忘记密码</a>
				</div>
				<div class="remeber">
					<input type="checkbox" name="" id="rado" value="" />
					<span>记住密码自动登录</span>
				</div>
				<div class="login">登录</div>
				<div class="register">注册</div>
			</section>
		</div>
		
	</body>
	<script type="text/javascript" src="js/jquery-2.0.3.js"></script>
	<script type="text/javascript">
	
	$(function(){
		$(".login").on("click",function(){
			$.ajax({
			type:'GET',
			url:'http://datainfo.duapp.com/shopdata/userinfo.php',
			dataType:'json',
			data:{
				status:"login",
			     userID:$('#username').val(),
			     password:$('#password').val()
			},
			success:function(data){
			  if(data==0){
			  	alert("用户名不存在")
			  }else if(data==2){
			  	alert("用户名密码不符")
			  }else{
			  	localStorage.setItem("username",data.userID)
				window.location.href="newproduct.html"
				
			}
			}
		})
		
		})
		$(".register").click(function(){
			window.location.href="login.html"
		})
		
		
		function bodyScale(){
				var devicewidth=document.documentElement.clientWidth;
				var scale=devicewidth/640;
				document.body.style.zoom=scale;
			}
			window.onresize=window.onload=function(){
				bodyScale();
			}
	})
		
	</script>
</html>
